{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "import pandas as pd\n",
    "import numpy as np\n",
    "from numpy import genfromtxt\n",
    "import os\n",
    "import seaborn as sns"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 79,
   "metadata": {},
   "outputs": [],
   "source": [
    "#importar os dados\n",
    "#ESTE É UM EXEMPLO DE IMPORTAÇÃO E ORGANIZAÇÃO DOS DADOS A SER SEGUIDO PARA TODOS OS OUTROS\n",
    "#GRÁFICOS DO MESMO TIPO, ALTERANDO O DOCUMENTO IMPORTADO\n",
    "pd1 = pd.read_csv(\".csv\")\n",
    "#criando o dataframe, renomeando colunas e ordenando valores em decrescente\n",
    "pd1=pd1.rename(columns={\"\":\"\", \"\":\"\"})\n",
    "pd1=pd1.sort_values(by=\"\", ascending=False, ignore_index=True)\n",
    "#excluir linhas que não contêm informações importante\n",
    "pd1=pd1.drop([])\n",
    "pd1.reset_index(inplace=True, drop = True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 83,
   "metadata": {},
   "outputs": [],
   "source": [
    "#criar dataframe com os mais citados e renomear as linhas para deixar mais inteligível\n",
    "pd1 = pd1.iloc[0:21]\n",
    "pd1 = pd1.replace([])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 89,
   "metadata": {},
   "outputs": [],
   "source": [
    "#criando gráfico de barras horizontal\n",
    "fig,ax = plt.subplots(figsize=(15,15))\n",
    "sns.barplot(data=table, x=\"\",y=\"\", palette = \"Blues_d\", saturation = 1)\n",
    "#adicionando rótulos às barras\n",
    "for p in ax.patches:\n",
    "    height=p.get_height()\n",
    "    width=p.get_width()\n",
    "    ax.text(x=width+3,\n",
    "    y=p.get_y()+(height/2),\n",
    "    s='{:.0f}'.format(width),\n",
    "    va='center')\n",
    "sns.set_context(\"paper\", font_scale = 1.5)\n",
    "#estilo do gráfico sem grade atrás\n",
    "sns.set_style(\"white\")\n",
    "#remover margens topo, chão, direita\n",
    "sns.despine(bottom=True)\n",
    "#remover ticks do eixo c\n",
    "plt.xticks([])\n",
    "#matplotlib.rc('xtick', labelsize=20) \n",
    "plt.rc('ytick', labelsize=20)\n",
    "\n",
    "\n",
    "#salvando a imagem\n",
    "plt.savefig('savefigl.png', dpi=300, bbox_inches='tight')"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
